package cn.tedu.baidashi.mapper;

import cn.tedu.baidashi.model.Zone;
import cn.tedu.baidashi.vo.ZoneVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
* <p>
    *  Mapper 接口
    * </p>
*
* @author tedu.cn
* @since 2022-02-16
*/
    @Repository
    public interface ZoneMapper extends BaseMapper<Zone> {
        @Select("SELECT zone.id,zone.zone_name FROM zone " +
                "LEFT JOIN city_zone ON zone.id=city_zone.zone_id " +
                "WHERE zone.id IN (SELECT zone_id FROM city_zone " +
                "WHERE city_id=(SELECT city.id FROM city " +
                "WHERE city.city_name=#{city_name}));")
        List<ZoneVo> findZoneNameByCityName(String city_name);
    }
